var zoomVal=document.getElementById("zoomVal");
function scaleIt(v) {
  //var scalePhotos = document.getElementsByClassName("scale-image");

//alert(v+":"+imgWidth);
  // Remap the 0-1 scale to fit the desired range
  floorSize = .26;
  if(imgWidth>500){
  	floorSize=500.0/imgWidth;
  }
  
  ceilingSize = 1.0;
  v = floorSize + (v * (ceilingSize - floorSize));


	img.style.width = (v*imgWidth)+"px";
  
  
  
  zoomVal.value=Math.round(v*100);
}
var demoSlider = new Control.Slider('handle1','track1', 
      {axis:'horizontal', minimum: 0, maximum:200, alignX: 2, increment: 2, sliderValue: 1});

//zoomVal.value=950/imgWidth*100;     

demoSlider.setValue(950.0/imgWidth,0);

demoSlider.options.onSlide = function(value){
  scaleIt(value);
}
demoSlider.options.onChange = function(value){
  scaleIt(value);
  
}

function startToZoom(){
	var zoomSize=zoomVal.value/100.0;
	//alert(zoomSize);
	//alert(demoSlider.getNearestValue(zoomSize));
	//if(zoomSize>1.0){
	//	var tempZoomSize=zoomSize;
	//}
	//scaleIt(zoomSize);
	//zoomSize=(1.0-0.26)*zoomSize+0.26;
	//zoomSize=(zoomSize-0.26)/(1.0-0.26);
	//demoSlider.setValue(zoomSize,0);
	
	//if(tempZoomSize>1.0){
img.style.width = (zoomSize*imgWidth)+"px";
	//}	
}